package com.yzt.zhuju.gift;

import com.yzt.zhuju.network.AresSubscriber;
import com.yzt.zhuju.network.biz.BizLayer;
import com.yzt.zhuju.network.entity.gift.Gift;
import com.yzt.zhuju.network.entity.gift.GiftCacheInfo;
import com.yzt.zhuju.network.entity.gift.GiftResponse;

import java.util.ArrayList;
import java.util.List;

/**
 * 礼物管理类
 */
public class GiftManager {

    /**
     * 钻石礼物
     */
    public List<Gift> mDiamondGiftList = new ArrayList<>();

    private GiftCacheInfo giftCacheInfo;

    private static GiftManager mInstance;
    private int[] selectIndex = {-1, -1, -1, -1};
    private int[] selectTab = {-1, -1, -1, -1};
    private int[] selectUbiIndex = {-1, -1, -1, -1};
    private int[] selectUbiTab = {-1, -1, -1, -1};

    private List<Integer> tabId;

    private GiftManager() {
    }

    public static GiftManager getInstance() {
        if (mInstance == null) {
            mInstance = new GiftManager();
        }
        return mInstance;
    }

    public List<Integer> getTabId() {
        return tabId;
    }

    public void setTabId(List<Integer> tabId) {
        this.tabId = tabId;
    }

    public GiftCacheInfo getGiftCacheInfo() {
        return giftCacheInfo;
    }

    public void setGiftCacheInfo(GiftCacheInfo giftCacheInfo) {
        this.giftCacheInfo = giftCacheInfo;
    }

    public int[] getSelectIndex() {
        return selectIndex;
    }

    public void setSelectIndex(int[] selectIndex) {
        this.selectIndex = selectIndex;
    }

    public int[] getSelectUbiIndex() {
        return selectUbiIndex;
    }

    public void setSelectUbiIndex(int[] selectUbiIndex) {
        this.selectUbiIndex = selectUbiIndex;
    }

    public int[] getSelectTab() {
        return selectTab;
    }

    public void setSelectTab(int[] selectTab) {
        this.selectTab = selectTab;
    }

    public int[] getSelectUbiTab() {
        return selectUbiTab;
    }

    public void setSelectUbiTab(int[] selectUbiTab) {
        this.selectUbiTab = selectUbiTab;
    }

    /**
     * 获取钻石礼物
     */
    public List<Gift> getDiamondGiftList() {
        return mDiamondGiftList;
    }

    /**
     * 获取礼物数据
     */
    public void getGiftListData() {
        BizLayer.getInstance().getGiftModule().getGiftList(new AresSubscriber<GiftResponse>() {
            @Override
            public void onSuccess(GiftResponse response) {
                if (response != null) {
                    {//钻石礼物
                        if (response.getGiftList().size() > 0) {
                            mDiamondGiftList.clear();
                            mDiamondGiftList.addAll(response.getGiftList());
                        }
                    }
                }
            }

            @Override
            protected void onFinallyEnd() {
                super.onFinallyEnd();
            }
        });
    }
}
